package p270jp;

import p243io.reactivex.exceptions.CompositeException;
import p244ip.Call;
import p244ip.Response;
import p418pd.RxJavaPlugins;
import p436q6.StringMerger;
import p593wc.AbstractC6902j;
import p593wc.AbstractC6903n;
import p671zc.Disposable;

/* renamed from: jp.c */
/* loaded from: classes2.dex */
public final class CallExecuteObservable<T> extends AbstractC6902j<Response<T>> {

    /* renamed from: a */
    public final Call<T> f18270a;

    /* compiled from: CallExecuteObservable.java */
    /* renamed from: jp.c$a */
    /* loaded from: classes2.dex */
    public static final class C3980a implements Disposable {

        /* renamed from: a */
        public final Call<?> f18271a;

        /* renamed from: b */
        public volatile boolean f18272b;

        public C3980a(Call<?> bVar) {
            this.f18271a = bVar;
        }

        @Override // p671zc.Disposable
        /* renamed from: a */
        public void mo78a() {
            this.f18272b = true;
            this.f18271a.cancel();
        }

        @Override // p671zc.Disposable
        /* renamed from: e */
        public boolean mo77e() {
            return this.f18272b;
        }
    }

    public CallExecuteObservable(Call<T> bVar) {
        this.f18270a = bVar;
    }

    @Override // p593wc.AbstractC6902j
    /* renamed from: r */
    public void mo983r(AbstractC6903n<? super Response<T>> nVar) {
        boolean z;
        Throwable th;
        Call<T> clone = this.f18270a.mo12304clone();
        C3980a aVar = new C3980a(clone);
        nVar.mo306c(aVar);
        if (!aVar.f18272b) {
            try {
                Response<T> execute = clone.execute();
                if (!aVar.f18272b) {
                    nVar.mo305g(execute);
                }
                if (!aVar.f18272b) {
                    try {
                        nVar.onComplete();
                    } catch (Throwable th2) {
                        th = th2;
                        z = true;
                        StringMerger.m2841u(th);
                        if (z) {
                            RxJavaPlugins.m3026b(th);
                        } else if (!aVar.f18272b) {
                            try {
                                nVar.mo307b(th);
                            } catch (Throwable th3) {
                                StringMerger.m2841u(th3);
                                RxJavaPlugins.m3026b(new CompositeException(th, th3));
                            }
                        }
                    }
                }
            } catch (Throwable th4) {
                th = th4;
                z = false;
            }
        }
    }
}
